package com.itlong.cloud.equip.property;

import com.itlong.cloud.POJO.DTO.property.PropertyEquipAuthGetDTO;
import com.itlong.cloud.POJO.DTO.property.UserDeviceAuthAddreddDTO;
import com.itlong.cloud.POJO.PO.TimeTaskAuthDeviceAddressInfoPO;
import com.itlong.cloud.POJO.VO.property.AppUserGetDeviceAuthVO;
import com.itlong.cloud.POJO.VO.property.EquipAuthUserGetVO;
import com.itlong.cloud.POJO.VO.property.PropertyEquipSimpleVO;
import com.itlong.cloud.utils.page.Page;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * <desc>
 *       设备权限接口服务
 * </desc>
 *
 * @createDate 2017/10/13
 */
@FeignClient(name = "equip-service")
public interface IPropertyDeviceAuthServiceClient {

    /**
     * <desc>
     *      合成并保存受设备地址变更影响的住户设备权限
     * <desc/>
     *
     * @param   userDeviceAuthAddreddDTOS  地址信息集
     * @param   authSource  权限来源
     * @return
     * @author zhangs
     * @createDate 2017/11/2
     */
    @PostMapping(path = "/saveUserAuthByAddr")
    void saveUserAuthByAddr(
            @RequestBody List<UserDeviceAuthAddreddDTO> userDeviceAuthAddreddDTOS,
            @RequestParam("authSource") Integer authSource) throws Exception;

    /**
     * <desc>
     *      迁出住户时删除地址对应的其他类别的设备权限
     * <desc/>
     * @param   userDeviceAuthAddreddDTOS  地址信息集
     * @return
     * @author zhangs
     * @createDate 2017/11/2
     */
    @PostMapping(path = "/delUserOtherAuth")
    void delUserOtherAuth(@RequestBody List<UserDeviceAuthAddreddDTO> userDeviceAuthAddreddDTOS) throws Exception;

    /**
     * <desc>
     *      设备授权-更新用户设备权限
     * <desc/>
     *
     * @param loginUserId 用户登录Id
     * @param userId 用户Id
     * @param projectId 项目Id
     * @param appUserGetDeviceAuthVOS 用户设备权限信息
     * @return Integer 影响的数据数量
     * @author zhangs
     * @createDate 2017/10/10
     */
    @RequestMapping(path = "manage/updateSmartCardUserDeviceAuth", method = RequestMethod.POST)
    Integer updateSmartCardUserDeviceAuth(
            @RequestParam("loginUserId") String loginUserId,
            @RequestParam("userId") String userId,
            @RequestParam("projectId") String projectId,
            @RequestBody List<AppUserGetDeviceAuthVO> appUserGetDeviceAuthVOS) throws Exception;

    /**
     * <desc>
     *       家半径临时授权（包括住户管理设备授权和家半径一卡通用户授权）设备授权-更新用户临时设备权限(物业设备授权按钮)
     *      前端页面只能一次传一个页面的数据，传当前页面所有设备以及勾选上的设备(电梯设备还需传楼层信息)
     * <desc/>
     *
     * @param loginUserId 用户登录Id
     * @param userId 用户Id
     * @param projectId 项目Id
//     * @param authSource 来源标识
     * @param deviceType 设备类型
     * @param currentDevices 当前页面所有设备唯一码，以英文逗号拼接
     * @param selectDevices 当前页面所有选中设备唯一码，以英文逗号拼接
     * @param naturalfloorList 选中电梯设备时传输的楼层信息
     * @return
     * @author zhangs
     * @createDate 2017/10/10
     */
    @RequestMapping(path = "manage/updateHouseHoldTmpDeviceAuth", method = RequestMethod.POST)
    void updateHouseHoldTmpDeviceAuth(
            @RequestParam(value = "loginUserId",required = false) String loginUserId,
            @RequestParam("userId") String userId,
            @RequestParam("projectId") String projectId,
//            @RequestParam("authSource") Integer authSource,
            @RequestParam("deviceType") Integer deviceType,
            @RequestParam(value = "currentDevices",required = false) String currentDevices,
            @RequestParam(value = "selectDevices",required = false) String selectDevices,
            @RequestBody List<String> naturalfloorList,
            @RequestParam("mark") String mark) throws Exception;

    /**
     * <desc>
     *      设备授权-获取用户设备权限
     * <desc/>
     *
     * @param userId 用户Id
     * @param projectId 项目Id
     * @param deviceType 设备类型
     * @return List<AppUserGetDeviceAuthVO> 用户设备权限信息集
     * @author zhangs
     * @createDate 2017/10/10
     */
    @RequestMapping(path = "manage/getUserDeviceAuth", method = RequestMethod.POST)
    List<AppUserGetDeviceAuthVO> getUserDeviceAuth(@RequestParam("userId") String userId,
                                                   @RequestParam("projectId") String projectId,
                                                   @RequestParam("deviceType") String deviceType) throws Exception;

    /**
     * <desc>
     *      查询待刷新权限的地址对象集
     * <desc/>
     * @param  params 查询参数
     * @return  查询到受影响地址集合
     * @author Biao.R
     * @createDate 2018/2/7
     */
    @RequestMapping(path = "manage/getNotFreshAddrByParams", method = RequestMethod.POST)
    List<TimeTaskAuthDeviceAddressInfoPO> getNotFreshAddrByParams(@RequestBody Map<String, Object> params);


    /**
     * <desc>
     *      获取缓存中标记设备地址变更刷新用户权限定时任务执行状态
     * <desc/>
     * @param
     * @return boolean
     * @author Biao.R
     * @createDate 2018/2/7
     */
    @RequestMapping(path = "manage/getDeviceAuthTimeTaskExexuterStatus", method = RequestMethod.POST)
    boolean getDeviceAuthTimeTaskExexuterStatus();

    /**
     * <desc>
     *      在缓存中标记设备地址变更刷新用户权限定时任务执行状态
     * <desc/>
     * @param  isWorking  定时任务执行状态(true:正在执行|false:未执行)
     * @return
     * @author Biao.R
     * @createDate 2018/2/7
     */
    @RequestMapping(path = "manage/updateDeviceAuthTimeTaskExexuterStatus", method = RequestMethod.POST)
    void updateDeviceAuthTimeTaskExexuterStatus(@RequestParam("isWorking")boolean isWorking);

    /**
     * <desc>
     *      定时任务刷新用户权限
     * <desc/>
     * @param   userDeviceAuthAddreddDTOS  地址信息集
     * @param   authSource  权限来源
     * @param   handlerTime  执行时间
     * @return  定时任务表被执行的个数
     * @author Biao.R
     * @createDate 2018/2/8
     */
    @RequestMapping(path = "manage/updateAddrUserAuthByTimeTask", method = RequestMethod.POST)
    Integer updateAddrUserAuthByTimeTask(@RequestBody List<UserDeviceAuthAddreddDTO> userDeviceAuthAddreddDTOS,
                                     @RequestParam("authSource") Integer authSource,
                                     @RequestParam("handlerTime")String handlerTime);

    /**
     * <desc>
     *      通知其它服务清缓存
     * <desc/>
     * @param   list
     * @return
     * @author Juguang.S
     * @createDate 2018/4/17
     */
    @RequestMapping(path = "manage/noticeOtherServiceRedisBySamrtCard", method = RequestMethod.POST)
    void noticeOtherServiceRedisBySamrtCard(@RequestBody List<EquipAuthUserGetVO> list);

    /**
     * <desc>
     *     执行调度smart_card_face_pull_cloud_info表中的大于允许同步时间的数据推送至人脸识别系统
     * </desc>
     *
     * @author Juguang.S
     * @createDate 2019/07/06
     */
    @RequestMapping(path = "/smartCardFace/timeTaskPushSamrtCardFace", method = RequestMethod.POST)
    void timeTaskPushSamrtCardFace() throws Exception;

    /**
     * <desc>
     *      获取用户有权限的设备分页列表
     * </desc>
     *
     * @param  propertyEquipAuthGetDTO 查询参数DTO
     * @return 用户有权限的设备分页列表
     * @Author Zhu.yj
     * @createDate  2021/4/21
     */
    @RequestMapping("/setting/user/getUserHaveAuthDevice")
    Page<PropertyEquipSimpleVO> getUserHaveAuthDevice(@RequestBody PropertyEquipAuthGetDTO propertyEquipAuthGetDTO) throws Exception;

    /**
     * <desc>
     *      删除用户电梯和门禁的分组权限
     * </desc>
     *
     * @param projectId
     * @param userId
     * @return
     * @Author Zhu.yj
     * @createDate  2021/5/11
     */
    @RequestMapping("/setting/user/deleteUserDeviceAuth")
    Integer deleteUserDeviceAuth(@RequestParam("projectId") String projectId, @RequestParam("userId") String userId) throws Exception;
}
